#include <iostream>
int main()
{
	int m, n, i, j, k, *lpData, *lpRotate, tmp;
	bool bContinue;
	std::cin >> m >> n;
	if (m >= n)
	{
		m = n - 1;
	}
	lpData = new int[n];
	lpRotate = new int[m];
	for (i = 0; i < n; ++i)
	{
		lpData[i] = i + 1;
	}
	for (i = 0; i < m; ++i)
	{
		lpRotate[i] = 0;
	}
	k = 0;
	do
	{
		std::cout << (++k) << ":    ";
		for (i = 0; i < n; ++i)
		{
			std::cout << lpData[i] << ' ';
		}
		std::cout << '\n';
		i = 1;
		do
		{
			tmp = lpData[m - i];
			for (j = m - i; j < n - 1; ++j)
			{
				lpData[j] = lpData[j + 1];
			}
			lpData[n - 1] = tmp;
			++(lpRotate[m - i]);
			if (lpRotate[m - i] == n - m + i)
			{
				lpRotate[m - i] = 0;
				++i;
				bContinue = true;
			}
			else
			{
				bContinue = false;
			}
		} while (bContinue && i <= m);
	} while (i <= m);
	delete[]lpRotate;
	delete[]lpData;
	return 0;
}